/**
 * 基础菜单 商品管理
 */
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>评价</el-breadcrumb-item>
    </el-breadcrumb>
        <br />
        <el-button
          size="small"
          type="primary"
          icon="el-icon-search"
          @click="goods()"
          >查看商品评价</el-button
        >
         <el-button
          size="small"
          type="primary"
          icon="el-icon-search"
          @click="service()"
          >查看服务评价</el-button
        >
    <br />
    <br />
    <!--列表-->
    <el-table
      size="small"
      :data="listData"
      highlight-current-row
      v-loading="loading"
      border
      element-loading-text="拼命加载中"
      style="width: 100%"
    >
      <el-table-column align="center" type="selection" width="60">
      </el-table-column>
      <el-table-column sortable prop="id" label="评价id" width="100">
      </el-table-column>
      <el-table-column sortable prop="context" label="评价内容" width="100">
      </el-table-column>
      <el-table-column sortable prop="score" label="评价分" width="100">
      </el-table-column>
      <el-table-column sortable prop="orderId" label="订单项id" width="100">
      </el-table-column>
      <el-table-column sortable prop="createtime" label="创建时间" width="150">
      </el-table-column>
       <el-table-column sortable prop="storeName" label="店家名" width="200">
      </el-table-column>
      <el-table-column sortable prop="hotelReply" label="店家回复" width="100">
      </el-table-column>
      <el-table-column align="center" label="操作" min-width="300">
        <template slot-scope="scope">
      
          <el-popover placement="right" width="400" trigger="click">
            <el-table :data="gridData">
              <el-table-column
                width="150"
                property="id"
                label="订单项id"
              ></el-table-column>
              <el-table-column
                width="100"
                property="name"
                label="商品名"
              ></el-table-column>
              <el-table-column
                width="100"
                property="quantity"
                label="数量"
              ></el-table-column>
              <el-table-column
                width="100"
                property="sellPrice"
                label="售价"
              ></el-table-column>
              <el-table-column
                width="100"
                property="size"
                label="规格"
              ></el-table-column>
            </el-table>
            <el-button
              slot="reference"
              size="mini"
              @click="order(scope.$index, scope.row)"
              >订单详情</el-button
            >
          </el-popover>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <Pagination
      v-bind:child-msg="pageparm"
      @callFather="callFather"
    ></Pagination>
    <!-- 编辑/增加界面 -->
    <el-dialog
      :title="title"
      :visible.sync="editFormVisible"
      width="30%"
      @click="closeDialog"
    >
      <el-form
        label-width="120px"
        :model="evaluate"
        :rules="rules"
        ref="evaluate"
      >
        <el-form-item label="回复" prop="hotelReply">
          <el-input
            size="small"
            v-model="evaluate.hotelReply"
            auto-complete="off"
            placeholder="请输入回复内容"
          ></el-input>
        </el-form-item>

     
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeDialog">取消</el-button>
        <el-button
          size="small"
          type="primary"
          :loading="loading"
          class="title"
          @click="submitForm('evaluate')"
          >保存</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { deptList, deptSave, deptDelete } from "../../api/userMG";
import * as store from "../../api/store.js";
import Pagination from "../../components/Pagination";
import axios from "axios";
export default {
  //model
  data() {
    return {
      nshow: true, //switch开启
      fshow: false, //switch关闭
      loading: false, //是显示加载
      editFormVisible: false, //控制编辑页面显示与隐藏
      title: "回复",
      evaluate: {
        id: "",
        hotelReply: "",
      },
      // rules表单验证
      rules: {
        // deptName: [
        //   { required: true, message: '请输入部门名称', trigger: 'blur' }
        //  ],
        //  deptNo: [{ required: true, message: '请输入部门代码', trigger: 'blur' }]
      },
      formInline: {
        page: 1,
        limit: 5,
        usermannge: {
          customerId: "",
          customerInickname: "",
          customerPhonenumber: "",
          customerType: "",
          customerEmail: "",
          customerIcreater: "",
          customerIcreattime: "",
          customerIeditor: "",
          customerIedittime: "",
        },  
      },
      // 删除部门
      seletedata: {
        ids: "",
        token: localStorage.getItem("logintoken"),
      },
      userparm: [], //搜索权限
      listData: [], //用户数据
      gridData: [],
      // 分页参数
      pageparm: {
        currentPage: 1,
        pageSize: 5,
        total: 10,
      },
      storeId: "",
      //下拉框属性
      options: [],
      value: "",
    };
  },
  // 注册组件
  components: {
    Pagination,
  },
  /**
   * 数据发生改变
   */

  /**
   * 创建完毕
   */
  created() {
    this.getDate();
    //this.selects();
  },

  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
    getDate() {
      store
        .Evaluate(
          this.formInline.page,
          this.formInline.limit
        )
        .then((res) => {
          console.log("1111111111111111", res.data);
          this.listData = res.data.list;
          this.pageparm.total = res.data.total;
          console.log(this.pageparm);
        });
    },
    goods(){
      store.goods(  this.formInline.page,
          this.formInline.limit)
                .then((res) => {
          this.listData = res.data.list;
          this.pageparm.total = res.data.total;
          console.log(this.pageparm);
        });
    },
      service(){
      store.service(  this.formInline.page,
          this.formInline.limit)
                .then((res) => {
          this.listData = res.data.list;
          this.pageparm.total = res.data.total;
          console.log(this.pageparm);
        });
    },
    // 分页插件事件
    callFather(parm) {
      this.formInline.page = parm.currentPage;
      this.formInline.limit = parm.pageSize;
      this.getDate();
    },
    // 搜索事件
    search() {
      axios
        .post("/usermannge/search", this.formInline)
        .then((res) => {
          console.log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", res.data);
          this.listData = res.data.list;
          this.pageparm.total = res.data.total;
          console.log(this.pageparm);
        })
        .catch((res) => {});
    },
    //显示编辑界面
    handleEdit: function (index, row) {
      this.editFormVisible = true;
      this.evaluate.id = row.id;
    },
   
    order(index, row) {
      store.order(row.id).then((res) => {
        console.log("1111111111111111", res.data);
        this.gridData = res.data;
      });
    },
    // 删除角色
    deleteUser(index, row) {
      this.$confirm("确定要删除吗?", "信息", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          console.log(index, "-------------", row);
          console.log(axios);
          //这个是restful风格
          axios
            .post("/usermannge/delete/" + row.customerId, {
              //传的对象
            })
            .then((res) => {
              this.$message({
                type: "success",
                message: "用户已删除!",
              });
              this.getDate();
            })
            .catch((err) => {
              this.loading = false;
              this.$message.error("用户删除失败，请稍后再试！");
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 关闭编辑、增加弹出框
    closeDialog() {
      this.editFormVisible = false;
    },
  },
};
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
</style>

 
 